# Contributor: Simon Frankenberger <simon-alpine@fraho.eu>
# Maintainer: Simon Frankenberger <simon-alpine@fraho.eu>
pkgname=java-asmtools
_pkgver=7.0-b06
pkgver=${_pkgver/-b/.}
pkgrel=0
pkgdesc="The AsmTools open source project is used to develop tools for the production of proper and improper Java '.class' files"
url="http://hg.openjdk.java.net/code-tools/asmtools"
arch="noarch !mips !mips64" # java
license="GPL-2.0"
makedepends="openjdk8"
options="!check" # this package has no tests
subpackages="$pkgname-doc:_doc"
source="asmtools-$_pkgver.tar.bz2::http://hg.openjdk.java.net/code-tools/asmtools/archive/$_pkgver.tar.bz2
http://ftp-stud.hs-esslingen.de/pub/Mirrors//ftp.apache.org/dist/ant/binaries/apache-ant-1.9.13-bin.zip
"
builddir="$srcdir/asmtools-$_pkgver"

_ant_home="$srcdir"/apache-ant-1.9.13/

build() {
	cd "$builddir/build"

	# fix the build target directory
	sed -i "s@^BUILD_DIR.\+@BUILD_DIR = $builddir/target@" build.properties

	$_ant_home/bin/ant
}

package() {
	_destdir="$pkgdir/usr/share/java/asmtools"
	mkdir -p "$_destdir"
	cp -r \
		$builddir/target/binaries/lib \
		$builddir/target/binaries/LICENSE \
		"$_destdir"
}

_doc() {
	_destdir="$subpkgdir/usr/share/java/asmtools"
	mkdir -p "$_destdir"
	cp -r \
		$builddir/target/binaries/doc \
		$builddir/target/binaries/README.html \
		"$_destdir"
}

sha512sums="c910cd36a93de648b1dde613b856cdde124a4b46469ff2cff62ebd17c83fc35573b212e50e38a396fb1e43fe6427aa60cb4eb6bfe4c0d641e4c057b6e28f114e  asmtools-7.0-b06.tar.bz2
873062cf789e1572ec4ef3cdbb15c0d3a57e5a0794068591565367d4cec15b9f9a24f59734a85170d61b23eb9288d6bafd35a9ae2b015b09c7a175e344cb4e1c  apache-ant-1.9.13-bin.zip"
